package com.web.java0401redis.controller;

import com.web.java0401redis.entity.Student;
import com.web.java0401redis.service.StudentService;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StudentController {

    @Resource
    private StudentService studentService;

    @GetMapping("/student/{id}")
    public ResponseEntity<Student> findStudentById(
            @PathVariable Integer id){
        Student stu = studentService.findStudentById(id);
        return ResponseEntity.ok(stu);
    }
}
